
<?php include '../../common/view/header.html.php';?>
<style>
    td{position: relative;}
    .addcategory{position: absolute;right: 0;
        top:0;}
    i[class^="icon-"], i[class*=" icon-"], .link-icon i[class^="icon-"], .link-icon i[class*=" icon-"] {
        font-size: 18px;
        color: #333;
    }
    .actioncategory{padding: 0 15px 15px 15px;}
</style>
<div class="actioncategory" >
<?php echo html::a($this->createLink('setting', 'addbigcategory'),$lang->setting->addbigcategory,"","data-toggle='modal' class='model btn btn-primary'") ;?>
<?php echo html::a($this->createLink('setting', 'addproject'),$lang->setting->addproject,"","data-toggle='modal' class='model btn btn-primary'") ;?>
<?php echo html::a($this->createLink('setting', 'addcategory'),$lang->setting->addcategory,"","data-toggle='modal' class='model btn btn-primary'") ;?>
</div>
<table class="table table-data table-bordered text-center table-fixedHeader">
    <thead>
    <tr class="text-center">
        <th>类别</th>
        <th>项目</th>
        <th>违规小分类</th>
        <th>扣分</th>
        <th>通报批评</th>
        <th>责令谈话</th>
        <th>谈话提醒</th>
        <th>诫勉谈话</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
<?php foreach($bigcategory as $bigval):?>
    <tr>
        <td rowspan="<?php echo $bigval->count;?>">
            <?php echo $bigval->mistake;?>
            <a href="<?php echo $this->createLink('setting', 'editbigcategory',"id={$bigval->id}"); ?>" data-toggle="modal" class="btn-icon model" title="编辑"><i class="icon-common-edit icon-pencil"></i></a>
            <a title="删除" onclick="delbigcategory(<?php echo $bigval->id;?>)" class="btn-icon iframe"><i class="icon-remove"></i></a>
        </td>
        <?php foreach($bigval->project as $pkey=>$pro):?>
            <?php if($pkey==0) :?>
        <td rowspan="<?php echo $pro->count;?>">
            <?php echo $pro->mistake;?>
            <a href="<?php echo $this->createLink('setting', 'addcategorys',"pid={$bigval->id}&cpid={$pro->id}"); ?>" class="addcategory" data-toggle="modal" title="添加小分类"><i class="icon-plus"></i></a>
            <a href="<?php echo $this->createLink('setting', 'editproject',"id={$pro->id}"); ?>" data-toggle="modal" class="btn-icon model" title="编辑"><i class="icon-common-edit icon-pencil"></i></a>
            <a title="删除" onclick="delproject(<?php echo $pro->id;?>)" class="btn-icon iframe"><i class="icon-remove"></i></a>

        </td>
                <?php foreach($pro->category as $ck=>$cval) :?>
                    <?php if($ck==0) :?>
        <td><?php echo $cval->mistake;?></td>
        <td><?php echo $cval->score;?></td>
         <td><?php echo $cval->notification;?></td>
        <td><?php echo $cval->zlth;?></td>
       <td><?php echo $cval->remind;?></td>
         <td><?php echo $cval->admonishing;?></td>
        <td>
                <a href="<?php echo $this->createLink('setting', 'editcategory',"id={$cval->id}"); ?>" data-toggle="modal" class="btn-icon model" title="编辑"><i class="icon-common-edit icon-pencil"></i></a>
            <a title="删除" onclick="delcategory(<?php echo $cval->id;?>)" class="btn-icon iframe"><i class="icon-remove"></i></a>
        </td>
                    <?php endif ?>
                    <?php endforeach ?>
                <?php endif ?>
        <?php endforeach ?>
    </tr>
<?php foreach($bigval->project as $pkey=>$pro):?>
        <?php if($pkey==0) :?>
            <?php foreach($pro->category as $ck=>$cval) :?>
                <?php if($ck>0) :?>
                    <tr>
            <td><?php echo $cval->mistake;?></td>
            <td><?php echo $cval->score;?></td>
            <td><?php echo $cval->notification;?></td>
          <td><?php echo $cval->zlth;?></td>
         <td><?php echo $cval->remind;?></td>
        <td><?php echo $cval->admonishing;?></td>
            <td>
                <a href="<?php echo $this->createLink('setting', 'editcategory',"id={$cval->id}"); ?>" data-toggle="modal" class="btn-icon model" title="编辑"><i class="icon-common-edit icon-pencil"></i></a>
                <a title="删除" onclick="delcategory(<?php echo $cval->id;?>)" class="btn-icon iframe"><i class="icon-remove"></i></a>

            </td>
        </tr>
                <?php endif ?>
            <?php endforeach ?>
        <?php endif ?>
    <?php endforeach ?>

<?php foreach($bigval->project as $pkey=>$pro):?>
        <?php if($pkey>0) :?>
            <tr>
                <td rowspan="<?php echo $pro->count; ?>">
                    <?php echo $pro->mistake;?>
                    <a href="<?php echo $this->createLink('setting', 'addcategorys',"pid={$bigval->id}&cpid={$pro->id}"); ?>" class="addcategory" data-toggle="modal" title="添加小分类"><i class="icon-plus"></i></a>
                    <a href="<?php echo $this->createLink('setting', 'editproject',"id={$pro->id}"); ?>" data-toggle="modal" class="btn-icon model" title="编辑"><i class="icon-common-edit icon-pencil"></i></a>
                    <a title="删除" onclick="delproject(<?php echo $pro->id;?>)" class="btn-icon iframe"><i class="icon-remove"></i></a>

                </td>
                <?php foreach($pro->category as $ck=>$cval) :?>
                    <?php if($ck==0) :?>
                        <td><?php echo $cval->mistake;?></td>
                        <td><?php echo $cval->score;?></td>
                        <td><?php echo $cval->notification;?></td>
                        <td><?php echo $cval->zlth;?></td>
                        <td><?php echo $cval->remind;?></td>
                        <td><?php echo $cval->admonishing;?></td>
                        <td>
                            <a href="<?php echo $this->createLink('setting', 'editcategory',"id={$cval->id}"); ?>" data-toggle="modal" class="btn-icon model" title="编辑"><i class="icon-common-edit icon-pencil"></i></a>
                            <a title="删除" onclick="delcategory(<?php echo $cval->id;?>)" class="btn-icon iframe"><i class="icon-remove"></i></a>

                        </td>
                    <?php endif ?>
                <?php endforeach ?>
            </tr>
<?php foreach($pro->category as $ck=>$cval) :?>
                <?php if($ck>0) :?>
                    <tr>
                        <td><?php echo $cval->mistake;?></td>
                        <td><?php echo $cval->score;?></td>
                        <td><?php echo $cval->notification;?></td>
                        <td><?php echo $cval->zlth;?></td>
                        <td><?php echo $cval->remind;?></td>
                        <td><?php echo $cval->admonishing;?></td>
                        <td>
                            <a href="<?php echo $this->createLink('setting', 'editcategory',"id={$cval->id}"); ?>" data-toggle="modal" class="btn-icon model" title="编辑"><i class="icon-common-edit icon-pencil"></i></a>
                            <a title="删除" onclick="delcategory(<?php echo $cval->id;?>)" class="btn-icon iframe"><i class="icon-remove"></i></a>

                        </td>
                </tr>
                <?php endif ?>
            <?php endforeach ?>

    <?php endif ?>


    <?php endforeach ?>


<?php endforeach ?>
    </tbody></table>
<script>
    function delcategory(id){
        if(confirm("确定要删除数据吗？")){
            url = createLink('setting','delcategory');
            $.ajax({
                type: "post",
                url: url,
                data: {"id":id},
                dataType: "json",
                success: function (data){
                    if (data.erro=='1'){
                        alert(data.data);
                        location=location;
                    }else {
                        alert(data.data);
                    }
                }

            })
        }
    }

    function delproject(id){
        if(confirm("确定要删除数据吗？")){
            url = createLink('setting','delproject');
            $.ajax({
                type: "post",
                url: url,
                data: {"id":id},
                dataType: "json",
                success: function (data){
                    if (data.erro=='1'){
                        alert(data.data);
                        location=location;
                    }else {
                        alert(data.data);
                    }
                }

            })
        }
    }

    function delbigcategory(id){
        if(confirm("确定要删除数据吗？")){
            url = createLink('setting','delbigcategory');
            $.ajax({
                type: "post",
                url: url,
                data: {"id":id},
                dataType: "json",
                success: function (data){
                    if (data.erro=='1'){
                        alert(data.data);
                        location=location;
                    }else {
                        alert(data.data);
                    }
                }

            })
        }
    }
</script>
<?php include '../../common/view/footer.html.php';?>
